<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
Route::get('think', function () {
    return 'hello,ThinkPHP5!';
});

Route::get('hello/:name', 'index/hello');

//Route::domain('api','api'); //设置域名绑定
//Route::rule(':version/user/:id','api/:version.user/index');//http://api.tp5.com/v1/user/2

//给用户发送验证码
Route::get(':version/code/:time/:token/<username>/:is_exist','api/:version.code/get_code')->pattern(['username' => '[a-zA-Z0-9.@]+']);//http://111.67.195.187:100/v1/code/123123/12/13800318000/0   

//用户注册接口
Route::post(':version/user/register','api/:version.user/register');//http://111.67.195.187:100/v1/user/register
//用户登录接口
Route::post(':version/user/login','api/:version.user/login');//http://111.67.195.187:100/v1/user/login
//用户上传头像
Route::post(':version/user/icon','api/:version.user/upload_head_img');//http://111.67.195.187:100/v1/user/icon
//用户修改密码
Route::post(':version/user/change_pwd','api/:version.user/change_pwd');//http://111.67.195.187:100/v1/user/change_pwd
//用户找回密码
Route::post(':version/user/find_pwd','api/:version.user/find_pwd');//http://111.67.195.187:100/v1/user/find_pwd
//用户绑定手机号
Route::post(':version/user/bind_phone','api/:version.user/bind_phone');//http://111.67.195.187:100/v1/user/bind_phone
//用户绑定邮箱
Route::post(':version/user/bind_email','api/:version.user/bind_email');//http://111.67.195.187:100/v1/user/bind_email
//用户绑定邮箱或手机号
Route::post(':version/user/bind_user_name','api/:version.user/bind_user_name');//http://111.67.195.187:100/v1/user/bind_user_name
//修改用户昵称
Route::post(':version/user/set_nickname','api/:version.user/set_nickname');//http://111.67.195.187:100/v1/user/set_nickname


/* 文章 */
//创建文章
Route::post(':version/article/save','api/:version.article/save'); // http://111.67.195.187:100/v1/article/save
//查看文章列表
Route::get(':version/articles/:time/:token/:user_id/[:num]/[:page]','api/:version.article/index'); // http://111.67.195.187:100/v1/articles/:time/:token/:user_id/:num/:page
//查看指定文章
Route::get(':version/article/:time/:token/:article_id','api/:version.article/read'); // http://111.67.195.187:100/v1/article/:time/:token/:article_id
//修改或保存文章
Route::put(':version/article/update','api/:version.article/update'); // http://111.67.195.187:100/v1/article/update
//删除文章
Route::delete(':version/article/:time/:token/:article_id','api/:version.article/delete'); // http://111.67.195.187:100/v1/article/:time/:token/:article_id

return [
   // 'api/:version/:controller/:function' => 'api/:version.:controller/:function', //版本. 改为 /
    // api版本路由
    //'api/:version/:controller'=>'api/:version.:controller/index',// 省略方法名时 网址格式:http://www.xxx.com/api/v1/index
   // 'api/:version/:controller/:function' => 'api/:version.:controller/:function'// 有方法名时 网址格式:http://www.xxx.com/api/v1/user/index
];
